home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir38
/
modcpi10.zip
/
MODCPI.DOC
< prev
next >
Wrap
Text File
|
1993-04-13
|
19KB
|
352 lines
13 April 1993
╔══════════════════════════════════════════════════════════╗
║ MODCPI 1.00 and DUMPCPI 1.00 ║
║ Copyright 1993 by Rufus S. Hendon. All rights reserved. ║
╚══════════════════════════════════════════════════════════╝
┌──────────────┐
│ Introduction │
└──────────────┘
Systems using a VGA video board and MS-DOS version 3.3 or higher allow you
to use screen fonts with different character sets by switching between what
are called "code pages". The fonts are contained in a "code-page information
file" with the extension .CPI. The code-page information file containing the
standard fonts for the VGA is called EGA.CPI.
The screen fonts for a given code page provide a set of 256 characters that
is different in toto from the set of characters used by other code pages. (For
this reason, "code pages" are also referred to as "character sets".) The
character sets of the standard code pages do, however, overlap a good deal; in
particular, the first 127 characters are the same in all the character sets.
In EGA.CPI, three fonts are supplied for each code page, all with the same
character set. In all three fonts, the characters are 8 pixels wide, but they
differ in height: in one font the characters are 16 pixels high, in one they
are 14 pixels high, and in the third they are 8 pixels high. Which of the
three fonts is used to display text on the screen depends on the video mode
and the number of lines shown on the screen. With a VGA board, for example,
the 16x8 font is used with a 25-line screen, the 14x8 font with a 28-line
screen, and the 8x8 font with a 43-line or 50-line screen. The 16x8 font is
sometimes called the "VGA font" and the 14x8 font the "EGA font".
Code pages are identified by numbers. MS-DOS 6.0 supports these six code
pages (the name of the character set associated with the code page is shown in
parentheses):
437 (English) 860 (Portuguese)
850 (Multilingual [Latin I]) 863 (Canadian-French)
852 (Slavic (Latin II]) 865 (Nordic)
(The EGA.CPI file supplied with earlier versions of MS-DOS that support code-
page switching may lack fonts for code page 852.)
Although MS-DOS recognizes five or six code pages, it only allows you to
switch between two code pages. Which two you have access to depends on the
country setting in effect. By default, the country setting specifies country
code 001, "English (United States)"; you may set your system to a different
country code by including a "COUNTRY=" line in your CONFIG.SYS file. If the
country setting is 001, the only two code pages you can use are 437 and 850;
as long as this setting is in effect, MS-DOS won't allow you to switch to the
Canadian-French code page, 863, or the Slavic code page, 852. If you need the
Slavic code page, you can gain access to it by setting your system to country
code 048, "Polish", in CONFIG.SYS, but then you are restricted to code pages
852 and 850 -- you can't switch to 437, for example.
MS-DOS considers one of the two code pages for a given country code to be
the "preferred character set" while the other is the "alternate character
set". For country code 001, 437 is the preferred code page, 850 the alternate;
for country code 850 ("Dutch"), on the other hand, 850 is the preferred code
page, 437 the alternate.
The purpose of ModCPI is to relax these restrictions somewhat in order to
make code-page switching more useful. It can't change the fact that for a
given country code you are limited to two specific code pages, but it does
make it possible to alter the actual fonts associated with those code pages,
so that in practice you can have two fonts with completely different character
sets between which you can switch by using the DOS CHCP ("change code page")
command. One thing ModCPI can do is to alter the associations of the existing
fonts with code pages. For country setting 001, for example, you can leave the
font associated with code page 437 unchanged while replacing the font
associated with code page 850 by the Slavic font normally associated with code
page 852. You can also substitute a font of your own for the standard font
assigned to a code page; if, for example, you have used a screen-font editor to
design a Russian font or have acquired such a font in some other way, you can
make it the font associated with code page 850, so that when you change to code
page 850 text will be displayed in Russian characters on the screen.
┌──────────────────────────────────────────────────┐
│ How to use ModCPI to create a modified .CPI file │
└──────────────────────────────────────────────────┘
ModCPI creates, from an existing .CPI file, a new .CPI file in which the
font for one of the code pages is replaced by a different font. The replace-
ment font can be either one of the fonts for a different code page in the
existing .CPI file or a custom-designed font stored in a separate file.
ModCPI requires four arguments:
(1) The name of the code-page information file from which a modified file is
to be created.
(2) The name to be given to the modified code-page information file.
(3) The number of the code page whose font is to be replaced. This must be
a code page that is valid for the current country setting, since MS-DOS won't
let you use a code page that isn't valid for the country setting.
(4) A specification of the source of the replacement font. If the font for
some other code page in the file specified by the first argument is to be used,
this argument is the number of the code page whose font is to be copied as the
replacement font. (This may be a code page that isn't valid for the current
country setting.) If the font is to be read from a file, this argument is the
name of the file.
When the replacement font comes from the same .CPI file, all three sizes of
the font are replaced (8x16, 8x14, and 8x8), and hence the replacement font
will be used both with the normal display of 25 lines per screen and when the
system is set to display more than 25 lines. When the replacement font is
supplied in a file, only the VGA 8x16 font is replaced, so that the replacement
is effective only for the standard 25-line display. (The file is expected to
contain only an 8x16 font, which means that the file must be exactly 4096 bytes
long.)
Here are two examples:
(1) If you want to have the Slavic font available as the alternate font with
country code 001, you can create a copy of EGA.CPI in which the Slavic font
taken from code page 852 is substituted for the font for code page 850 (since
850 is the only other code page you're allowed to use besides 437 when the
country code is 001). To do this, with the result written into SLAVIC.CPI, you
would issue this command:
modcpi c:\dos\ega.cpi c:\dos\slavic.cpi 850 852
(2) If you have used a font editor to create a VGA 8x16 font with Greek
characters (or have acquired such a font from someone else) and the font is
stored in GREEK.VGA, you can create a copy of EGA.CPI called GREEK.CPI in which
the 8x16 font for code page 850 is replaced by the Greek font by issuing this
command:
modcpi c:\dos\ega.cpi c:\dos\greek.cpi 850 c:\dos\greek.vga
If you want to replace the fonts associated with both the code pages that
the country code you use makes available, you can do so by invoking ModCPI
twice. Suppose, for example, that you want to substitute the Slavic character
set (associated with code page 852 in EGA.CPI) for the font normally associated
with code page 437 (so that you can edit Polish text) and a Cyrillic font
(stored in CYRILLIC.VGA) for the font normally associated with code page 850
(so that you can edit Russian text). To accomplish this, you would first
create a temporary .CPI file with the Slavic font copied from code page 852 in
EGA.CPI to code page 437 and then use this temporary .CPI file as the basis for
creating the final .CPI file with the font for code page 850 replaced by
CYRILLIC.VGA. The temporary .CPI file would then be erased. Here are the
necessary commands:
modcpi c:\dos\ega.cpi c:\dos\temp.cpi 437 852
modcpi c:\dos\temp.cpi c:\dos\polruss.cpi 850 c:\dos\cyrillic.vga
del c:\dos\temp.cpi
┌─────────────────────────────────┐
│ How to use a modified .CPI file │
└─────────────────────────────────┘
The procedure for using a modified .CPI file created by ModCPI is the same
as when you use the standard EGA.CPI to switch between code pages. There are
four parts to the procedure: (1) Certain lines must be added to CONFIG.SYS
in order to make code-page switching possible; this has to be done only once.
(2) At the beginning of each session, the DOS TSR program NLSFUNC, which
provides the ability to switch between code pages, must be loaded into memory.
(3) The fonts from the modified .CPI file must also be loaded into memory.
(4) As often as required during the session, the DOS command CHCP is issued to
change to whichever of the two available code pages you want text to be
displayed in.
(1) Modifying CONFIG.SYS
Two lines must be added to CONFIG.SYS. In this discussion, I assume that
the necessary system files are stored in C:\DOS. If this isn't true in your
case, change "C:\DOS" to the correct path.
The first line takes this form:
COUNTRY=nnn,,C:\DOS\COUNTRY.SYS
Replace "nnn" by the country code you want to put into effect. The country
code determines which two code pages MS-DOS will allow you to access. Even if
the code you want to be in effect is 001, "English (United States)", which is
the default, you still must include this line in CONFIG.SYS in order to enable
the code-page switching apparatus.
The second line takes this form:
DEVICE=C:\DOS\DISPLAY.SYS CON=(EGA,nnn,1)
"EGA" specifies the kind of video adapter in the system; "EGA" is a generic
term that includes both EGA and VGA. "nnn" is the number of the preferred
character set (code page) for the country code specified in the "COUNTRY="
line. If, for example, the country code is 001, "nnn" would be 437. "1"
specifies how many additional code pages are to be allowed for; since MS-DOS
only gives you access to two code pages, there is no point to specifying
anything except "1".
For "English (United States)", the actual lines would look like this:
country=001,,c:\dos\country.sys
device=c:\dos\display.sys con=(ega,437,1)
As is always the case with changes to CONFIG.SYS, these additions won't
take effect until you reboot the computer.
(2) Loading NLSFUNC
The ability to switch code pages is provided by NLSFUNC.EXE. The command
nlsfunc
must therefore be issued to activate this ability before you can actually
switch from one code page to another. Issuing this command causes NLSFUNC to
be loaded into memory as a "terminate-and-stay-resident" (TSR) program. The
command should be issued only once during any given session. If you make
regular use of code-page switching, you'll probably want to put the command in
your AUTOEXEC.BAT file so that it will be automatically executed at the
beginning of every session.
(3) Loading the fonts from the modified .CPI file
After NLSFUNC has been loaded, it is necessary to load fonts from a .CPI
file for the two available code pages. This is true regardless of whether the
standard .CPI file or a modified .CPI file is to be used.
The command to load fonts from a .CPI file takes this form:
MODE CON CP PREP=((nnn)fn)
"nnn" is the number of the alternate code page for the current country code
(the number of the code page that wasn't specified in the CONFIG.SYS line for
DISPLAY.SYS). If, for example, the country code is 001, "English (United
States)", and the line for DISPLAY.SYS in CONFIG.SYS specifies CON=(EGA,437,1),
"nnn" will be 850, the other of the two code pages, 437 and 850, that are valid
for country code 001. "fn" is the name of the .CPI file from which the fonts
are to be loaded. If the fonts are to be loaded from a modified .CPI file
named C:\DOS\GREEK.CPI, for instance, the following command would be issued:
mode con cp prep=((850)c:\dos\greek.cpi)
You can load fonts from different .CPI files at different points in the same
session. If, for example, you have, in addition to C:\DOS\GREEK.CPI with a
Greek font for code page 850, a file called C:\DOS\RUSSIAN.CPI with a Russian
font for code page 850, you can, after issuing the command shown above to
install the Greek font, issue the command
mode con cp prep=((850)c:\dos\russian.cpi)
to load the Russian font, which will replace the Greek font as the font
associated with code page 850. You can also specify the standard .CPI file to
switch back to the standard fonts for code pages 437 and 850:
mode con cp prep=((850)c:\dos\ega.cpi)
If you normally load non-standard fonts only once during each session, you
might find it convenient to put the MODE command in the AUTOEXEC.BAT file, so
that it will be executed automatically every time you start the computer. If
you put both the NLSFUNC and the MODE command in AUTOEXEC.BAT, the NLSFUNC
command must precede the MODE command.
(4) Switching between code pages
After you have used the MODE command to load screen fonts from a particular
.CPI file, the system displays text in the font for the preferred code page for
the country code currently in effect. (The preferred code page is the one you
specified in the DISPLAY.SYS line in CONFIG.SYS.) You can then, whenever you
wish, switch between the preferred code page and the alternate code page by
using the DOS "change code page" command, CHCP. If, for example, the two
available code pages are 437 and 850, the command
chcp 850
causes text to be displayed in the font associated with code page 850, and
the command
chcp 437
switches back to the font associated with code page 437.
┌───────────────────────────────────────────────────────┐
│ Using DumpCPI to obtain information about a .CPI file │
└───────────────────────────────────────────────────────┘
Another program, called DumpCPI, is supplied with ModCPI. DumpPCI reports
information about a code-page information file. A single argument giving the
name of the code-page information file to be dumped is required. The report is
displayed on the screen, but may be redirected to a file. For example, to
write information about the standard code-page information file for the VGA,
EGA.CPI, into the file EGACPI.DMP, you would issue this command:
dumpcpi c:\dos\ega.cpi >egacpi.dmp
The report gives the name of the file, the number of code pages, and, for
each code page, the code-page number, the number of fonts, and, for each font,
the character height and width and the number of characters.
The offsets of each code page and each font are also given. In the case of
fonts, the offset is the offset of the six-byte font header, which has this
structure:
one byte = character bitmap height, in pixels (16, 14, or 8)
one byte = character bitmap width, in pixels (always 8)
one byte = "relative height" (always 0)
one byte = "relative width" (always 0)
one word = number of characters (normally 256)
The array of bitmaps constituting the font begins at the specified offset + 6.
The number of bytes per bitmap is equal to the bitmap height specified in the
font header. The total length of the font is that number times the number of
characters specified in the font header.
===============================================================================
NOTICE
ModCPI and DumpCPI are copyrighted programs, the distribution and use of
which are controlled by the author and copyright owner, Rufus S. Hendon. These
programs are not in the public domain.
You may use the ModCPI and DumpCPI programs and this documentation file for
your own private, non-commercial purposes; there is no registration fee or
other type of charge for such use. You may give copies of the programs to
other individuals for their private, non-commercial use, provided that such
copies include both the program files (MODCPI.EXE and DUMPCPI.EXE) and this
documentation file (MODCPI.DOC) in unaltered form and provided that you neither
request nor accept remuneration in any form for the copies.
Commercial distribution of ModCPI and DumpCPI is forbidden unless there has
been prior approval by the copyright owner and the payment of a license fee.
Prohibited forms of commercial distribution include the bundling of the
programs with commercially distributed products such as software and books, the
distribution of the programs as part of a "premium" for magazine subscribers,
the distribution of the programs by companies that sell collections of
"freeware" and "shareware" programs on disks, and the posting of the programs
on electronic bulletin boards maintained by vendors of commercial products in
support of those products.
ModCPI and DumpCPI are made available without warranty of any kind. The
copyright owner is not liable for any damages resulting from the use of the
programs.
===============================================================================
Communications may be sent to me at this address:
Rufus S. Hendon
804 Still Hill Road
Hamden, CT 06518-1105
Electronic mail may be sent to userid 73250,2674 on CompuServe.